# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Angel Velasquez <angvp@archlinux.com.ve>
# Contributor: Stefan Husmann  <stefan-husmann@t-online.de>
# Contributor: Manuel C.

pkgname=python-configobj
pkgver=5.0.8
pkgrel=4
pkgdesc='Simple config file reader and writer'
arch=(any)
url='https://github.com/DiffSK/configobj'
license=(BSD)
depends=(python-six)
makedepends=(git python-setuptools)
source=("git+$url#commit=a58c2f4de0e9e854daa67fec630506e5a461eea9") # tag: v5.0.8
b2sums=('SKIP')

prepare() {
  cd configobj
  # Avoid the need for a local configobj install just for VERSION
  local _version=$(grep -oP "__version__ = '\K[^']+" src/configobj/_version.py)
  sed -i "/from validate/d;s/VERSION/\"$_version\"/" setup_validate.py
}

package() {
  cd configobj
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  python setup_validate.py install --root="$pkgdir" --optimize=1
}
